﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PPI.Client.Interface;
using PPI.Client.Presenter;
using PPI.Entities.Kml;
using PPI.Entities.Settings;

namespace PPI
{
    public partial class frmManageKml : frmBase, IManageKml
    {
        protected ManageKmlPresenter m_presenter;
        protected EKmlFile m_newKml;
        protected ESettingsBase m_KmlEntity;

        public EKmlFile NewKml
        {
            get { return m_newKml; }
        }

        public frmManageKml()
        {
            InitializeComponent();
            base.MenuMain.Visible = false;
            this.FormSize = FormSizes.Medium;
            m_presenter = new ManageKmlPresenter(this);

        }

        public string KmlText
        {
            get { return this.txtKml.Text; }
        }

        public ESettingsBase KmlEntity
        {
            get { return m_KmlEntity; }
            set { m_KmlEntity = value; }
        }

        public void LoadKmlText(string text)
        {
            txtKml.Text = text;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            m_presenter.Save();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void frmManageKml_Load(object sender, EventArgs e)
        {
            LoadKmlText(m_KmlEntity.SettingText);
        }
    }
}
